package org.sjm.samples.util;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

import sun.misc.BASE64Encoder;


public class MD5Utils {

	public static String GetMd5Code(String strObj) {
		String resultString = null;
		try {
			MessageDigest digest = MessageDigest.getInstance("MD5");
			byte[] b = digest.digest(strObj.getBytes());
			BASE64Encoder encoder = new BASE64Encoder();
			resultString = encoder.encode(b);
		} catch (NoSuchAlgorithmException e) {
			e.printStackTrace();
		}
		return resultString;
	}
	
}
